package com.gjy.learning.scala

import org.apache.spark.sql.{DataFrame, SparkSession}

object SparkReadOracle {
  def oracleDFCreate(spark:SparkSession,table_name:String): DataFrame = {
    val url = "jdbc:oracle:thin:@localhost:1521:ORCL"
    val user = "SCOTT"
    val password = "123456"
    val df = spark.read
      .format("jdbc")
      .option("url", url)
      .option("dbtable", table_name)
      .option("user", user)
      .option("password", password)
      .option("driver", "oracle.jdbc.driver.OracleDriver")
      .load()
    df
  }
}
